package com.example.myerp.controller;

import com.example.myerp.pojo.MakeHouse;
import com.example.myerp.pojo.PageMyself;
import com.example.myerp.service.MyFeignPurchaseService;
import com.mycloud.api.pojo.ApiGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@SuppressWarnings("all")
@RestController
@RequestMapping("/MyFeign/Purchase")
public class MyFeignPurchaseController {
    @Autowired
    MyFeignPurchaseService myFeignPurchaseService;

    @RequestMapping(value = "/oneadd", method = RequestMethod.POST)
    public Integer product_one_Add(@RequestParam("proName") String proName) {
        return myFeignPurchaseService.product_one_Add(proName);
    }

    @RequestMapping(value = "/twoadd", method = RequestMethod.POST)
    public Integer product_sencond_Add(@RequestParam("proName") String proName,
                                       @RequestParam("iId") Integer iId) {
        return myFeignPurchaseService.product_sencond_Add(proName, iId);
    }

    @RequestMapping(value = "/threeadd", method = RequestMethod.POST)
    public Integer product_three_Add(@RequestParam("proName") String proName, @RequestParam("iId") Integer iId,
                                     @RequestParam("iiId") Integer iiId) {
        Integer integer = myFeignPurchaseService.product_three_Add(proName, iId, iiId);
        return integer;
    }

    @RequestMapping("/makeHousePage")
        ///design/myfign
    PageMyself<MakeHouse> makeHousePagefindByPager(@RequestParam(value = "pageSize") Integer pageSize, @RequestParam(value = "pageNum") Integer pageNum) {
        return myFeignPurchaseService.makeHousePagefindByPager(pageSize, pageNum);
    }

    @RequestMapping("/updateInfoRepby")
    public void updateInfoRepby(@RequestParam(value = "product_id") Integer product_id) {
        myFeignPurchaseService.updateInfoRepby(product_id);
    }

    @RequestMapping("/goodsfindByPager")
    public PageMyself<ApiGoods> goodsfindByPager(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
      return  myFeignPurchaseService.goodsfindByPager(pageNum,pageSize);
    }

    @RequestMapping("/goodsfindByPagers")
    public PageMyself<ApiGoods> goodsfindByPagers(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
        return  myFeignPurchaseService.goodsfindByPagers(pageNum,pageSize);
    }

    @RequestMapping("/fanGoods")
    public List<ApiGoods> fanGoods(@RequestParam("fileId") Long fileId){
        return  myFeignPurchaseService.fanGoods(fileId);
    }
}
